from flask import Blueprint, render_template, request, current_app

login_bp = Blueprint('login', __name__)


@login_bp.route('/login', methods=['GET'])
def login():
    # 获取自定义 logger
    logger = current_app.config['custom_logger'].get_logger()
    logger.info('This is an login message')
    return render_template('login.html')
    # return '登录信息'


@login_bp.route('/login/submit', methods=['POST'])
def login_submit():
    from app import app
    username = request.form['username']
    password = request.form['password']
    app.logger.info(f'Login submitted - Username: {username}, Password: {password}')
    return username + '@' + password
